home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
CHASSIS_
/
HELPWIND.C
< prev
next >
Wrap
Text File
|
1992-05-14
|
3KB
|
114 lines
/************************************************************************************/
/* HelpWindowProc */
/************************************************************************************/
#include "MyHeaders.h"
int HelpWindowProc()
{
int HelpWindRetCode = 0;
int workPart;
int h,v;
Rect sizeRect;
ControlHandle workControlHandle;
SetPort (windTbl[1].windPtr); /* set as the grafPort */
workPoint = myEvent.where;
GlobalToLocal(&workPoint);
switch (myEvent.what) /* how did I get here? */
{
case (mouseDown): /* MouseDown? */
switch (myMouseWhere) /* What part of window? */
{
case (inContent): /* content region: */
workRect = (**helpList).rView; /* view area of list */
workRect.right += 16; /* plus scroll bar */
if (PtInRect(workPoint, &workRect)) /* if in the list area */
{
workBoolean = LClick (workPoint, myEvent.modifiers, helpList);
for (j=0; j<helpCount; j++) /* find which cell is on */
{
helpCell.h = 0;
helpCell.v = j;
if (LGetSelect(FALSE, &helpCell, helpList))
break;
}
if ((helpCell.v != helpPrev)
&& (j < helpCount))
{
helpPrev = helpCell.v;
helpHandle = GetResource('TEXT', 7700 + helpCell.v);
helpLong = SizeResource(helpHandle);
EraseRect (&(**windTbl[1].windTEH[0]).viewRect);
TESetText (*helpHandle+32, helpLong-32,
windTbl[1].windTEH[0]);
ReleaseResource (helpHandle);
TECalText (windTbl[1].windTEH[0]);
myActionProc (windTbl[1].windCntlH[0], 0);
InvalRect (&(**windTbl[1].windTEH[0]).viewRect);
}
}
else
{
workPart = FindControl (workPoint, /* check for control*/
windTbl[1].windPtr,
&workControlHandle);
if (workPart) /* if so, track it */
{
if (workPart != inThumb) /* if not in thumb: my proc */
/* to scroll and reset thumb */
/* on the basis of the scroll */
TrackControl (workControlHandle, workPoint,
(ProcPtr) -1);
else /* in thumb: use native routine */
{ /* then invoke my proc to */
/* scroll on the basis of thumb */
k = GetCtlValue (workControlHandle);
TrackControl (workControlHandle, workPoint, NIL);
k -= GetCtlValue (workControlHandle);
myActionProc(workControlHandle, (short) workPart);
}
}
}
break;
case (inDrag): /* drag region: */
DragWindow (windTbl[1].windPtr,
myEvent.where, &myDragRect);
break;
case (inGoAway): /* goaway region: */
if (TrackGoAway (windTbl[1].windPtr, myEvent.where))
WorkRetCode = HelpCloseProc();
break;
}
break;
case (activateEvt):
j = (int) BitAnd(myEvent.modifiers, activeFlag);
if (j) /* if activate... */
{
WorkRetCode = MenuUpdate(ProcHelp); /* set menus */
ShowControl (windTbl[1].windCntlH[0]);
HiliteControl (windTbl[1].windCntlH[0], 0);
LActivate (TRUE, helpList);
}
else /* if deactivate... */
{
HiliteControl (windTbl[1].windCntlH[0], 255); /* unhilite */
HideControl (windTbl[1].windCntlH[0]); /* hide (to match L/M) */
LActivate (FALSE, helpList);
}
break;
}
return HelpWindRetCode;
}